import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;


public class ApplyQQ {

	public static void main(String[] args)throws Exception{
		
		HttpClient httpclient=new DefaultHttpClient();
		HttpPost httppost=new HttpPost("http://www.kd185.com/ems.php");
		List<NameValuePair> formparams=new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("wen","EQ353574035CS"));
		formparams.add(new BasicNameValuePair("btnSearch","EMS快递查询"));
		
		UrlEncodedFormEntity uefEntity;
		
		uefEntity=new UrlEncodedFormEntity(formparams,"UTF-8");
		httppost.setEntity(uefEntity);
		
		HttpResponse response;
		response=httpclient.execute(httppost);
		System.out.println(response.getStatusLine());
		
		HttpEntity entity=response.getEntity();
		if(entity!=null){
			System.out.println(EntityUtils.toString(entity,"GBK"));
		}
		
		
		httpclient.getConnectionManager().shutdown();
		
	}
	
}
